package com.chaofan.messagebook.config;

import org.apache.ibatis.datasource.pooled.PooledDataSource;

import javax.sql.DataSource;

/**
 * @author 李超凡
 * @since 2022/4/3 1:31
 */
public class DataSourceFactory {
    private static final PooledDataSource dataSource;
    static {
        dataSource = new PooledDataSource();
        dataSource.setDefaultAutoCommit(true);
        dataSource.setDriver("com.mysql.cj.jdbc.Driver");
        dataSource.setUsername("root");
        dataSource.setUrl("jdbc:mysql://118.195.163.54/exercise3");
        dataSource.setPassword("123456");
    }
    public static DataSource getDataSource() {
        return dataSource;
    }
}
